package com.weharvest.edu.utlis;

import com.weharvest.edu.enums.ResultEnum;
import com.weharvest.edu.vo.ResultVo;
import org.springframework.data.domain.Pageable;

public class ResultUtil{

    public static ResultVo  success(ResultEnum resultEnum){
        ResultVo resultVo=new ResultVo();
        resultVo.setCode(resultEnum.getCode());
        resultVo.setMsg(resultEnum.getMsg());

        return resultVo;
    }

    public static ResultVo success(Object obj){
        ResultVo resultVo=new ResultVo();
        resultVo.setCode(ResultEnum.SUCCESS.getCode());
        resultVo.setMsg(ResultEnum.SUCCESS.getMsg());
        resultVo.setData(obj);
        return resultVo;
    }
    public static ResultVo  success(){
        ResultVo resultVo=new ResultVo();
        resultVo.setCode(ResultEnum.SUCCESS.getCode());
        resultVo.setMsg(ResultEnum.SUCCESS.getMsg());
        return resultVo;
    }


    public static ResultVo  error(){
        ResultVo resultVo=new ResultVo();
        resultVo.setCode(ResultEnum.ERROR.getCode());
        resultVo.setMsg(ResultEnum.ERROR.getMsg());
        return resultVo;
    }

    public static ResultVo  error(ResultEnum resultEnum){
        ResultVo resultVo=new ResultVo();
        resultVo.setCode(resultEnum.getCode());
        resultVo.setMsg(resultEnum.getMsg());
        return resultVo;
    }
}
